package com.xcc.order.controller;

import com.xcc.entities.CommonResult;
import com.xcc.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Slf4j
@RestController
public class ConsumerController {

    @Autowired
    RestTemplate restTemplate;

    //    private String REST_UTL = "http://localhost:8001"; //http调用
    //采用restTemplate的@LoadBalance调用
    private String REST_UTL = "http://cloud-provider-payment";

    @GetMapping("/consumer/discorver")
    public String discorver() {
        String result = restTemplate.getForObject(REST_UTL + "/payment/common", String.class);
        return result;
    }

}
